<template>
  <div class="dialog_box">
    <el-dialog
      v-model="dialogVisible"
      :width="bodyWidth"
      align-center
      :close-on-click-modal="false"
      destroy-on-close
    >
      <template #header>
        <div class="custom-header">
          <div class="header_box">
            <img class="header_icon" src="@/assets/info.png" alt="" />

            <div class="header_title">
              {{ title }}
            </div>
          </div>

          <div class="header-icon" @click="cancel">
            <el-icon><Delete /></el-icon>
          </div>
        </div>
      </template>

      <div class="dialog_content" :style="{ height: bodyHeight }">
        <dialogPage></dialogPage>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <div @click="cancel" class="cancleBtn">取消</div>
          <div @click="submit" class="subBtn">确定</div>
        </div>
      </template>
    </el-dialog>
  </div>
</template>


<script setup>
import { reactive, ref, defineExpose, defineProps } from "vue";
import { ElMessage } from "element-plus";
const dialogVisible = ref(false);
import { Search } from "@element-plus/icons-vue";

import dialogPage from "./dialogPage.vue";

const props = defineProps({
  //子组件接收父组件传递过来的值相当于vue2里面的props
  // getInfo: Function,
});

// 弹框的宽高
const bodyWidth = ref("1200px");
const bodyHeight = ref("550px");
const openDialog = () => {
  dialogVisible.value = true;
};

const title = ref("标题");

const submit = async () => {
  dialogVisible.value = false;

  ElMessage.success("确定成功");
};

const cancel = async () => {
  dialogVisible.value = false;

  // await props.getInfo();

  ElMessage.success("取消成功");
};

defineExpose({
  openDialog,
});
</script>


<style lang="scss" scoped>
.dialog_box {
  :deep(.el-dialog__header) {
    width: 100%;
    padding-right: 0px !important;
    height: 36px;
    background: linear-gradient(0deg, #eff2f9 0%, #ffffff 100%);
    border: 1px solid;
    border-color: #dddfe6;
    box-shadow: 0px -2px 14px rgba(0, 0, 0, 0.09);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    .custom-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      height: 100%;
      padding: 0 20px;
      box-sizing: border-box;
      .header-icon {
        cursor: pointer;
      }
      .header_box {
        display: flex;
        align-items: center;

        .header_icon {
          width: 16.2px;
          height: 16.2px;
          margin-right: 8px;
          vertical-align: middle;
        }
        .header_title {
          font-family: MicrosoftYaHei;
          color: #4c73c5;
          font-size: 14px;
        }
      }
    }
  }
  :deep(.el-dialog__headerbtn) {
    display: none;
  }

  :deep(.el-dialog__footer) {
    height: 50px;
    background: #ffffff;
    border-radius: 0px 0px 6px 6px;
    box-shadow: 0px -2px 14px rgba(0, 0, 0, 0.09);
    padding: 0;
    margin: 0;
    .dialog-footer {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      padding: 0 20px;
      .cancleBtn {
        width: 90px;
        height: 30px;
        background: #eeeeee;
        border: 1px solid;
        border-color: #e5e5e5;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: MicrosoftYaHei;
        color: #666666;
        font-size: 16px;
        margin-right: 16.34px;
        cursor: pointer;
      }
      .subBtn {
        width: 90px;
        height: 30px;
        background: linear-gradient(180deg, #8bb0ff 0%, #4c73c5 100%);
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: MicrosoftYaHei;
        color: #fefefe;
        font-size: 16px;
        cursor: pointer;
      }
    }
  }

  :deep(.el-dialog__body) {
    background: #eff2f9;
    // box-shadow: 0px 0px 8px rgba(110, 131, 208, 0.5);
    padding: 16px;
    margin: 0;
    box-sizing: border-box;
    .dialog_content {
      background: #ffffff;
      border-radius: 2px;
    }
  }
}
</style>
